package org.urey.fmp.producer.service;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RestController;
import org.urey.fmp.commom.entity.EnumType;
import org.urey.fmp.commom.entity.User;
import org.urey.fmp.commom.service.TestService;

@RestController
public class TestServiceImpl implements TestService {

	protected final Logger logger = LoggerFactory.getLogger(getClass());

	@Override
	public User findOne(Long id) {
		logger.info("findOne id:{}", id);
		User user = new User(id, "用户" + id, new Date());
		return user;
	}

	@Override
	public List<User> findList(List<Long> ids) {
		logger.info("findList ids:{}", ids);
		List<User> users = new ArrayList<User>();
		for (Long id : ids) {
			User user = new User(id, "用户" + id, new Date());
			users.add(user);
		}
		return users;
	}

	@Override
	public void update(User user1, User user2) {
		logger.info("update1 user1:{} ,user2:{}", user1, user2);
	}

	@Override
	public void update(User user, Date date) {
		logger.info("update2 user:{} ,date:{}", user, date);
	}

	@Override
	public void update(List<User> users, Date date, String name) {
		logger.info("update3 users:{} ,date:{} ,name:{}", users, date, name);
	}

	@Override
	public void update(List<User> users, List<EnumType> enums, String name, Long id) {
		logger.info("update4 users:{} ,enums:{} ,name:{} ,id: {}", users, enums, name, id);
	}

	@Override
	public Map<Long, User> findMap(List<Long> ids) {
		logger.info("findMap ids:{}", ids);
		Map<Long, User> users = new HashMap<Long, User>();
		for (Long id : ids) {
			User user = new User(id, "用户" + id, new Date());
			users.put(id, user);
		}
		return users;
	}

}
